package user;

import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-14
 * Time: 14:07
 */
public class Main {
    public static User logn() {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name = scan.nextLine();
        System.out.println("Hello "+ name +", 请输入你的身份：");
        System.out.println("1. 管理员     2.普通用户");

        while(true) {
            int choice = scan.nextInt();
            if(choice == 1) {
                return new AdminUser(name);
            } else if(choice == 2){
                return new NornmalUser(name);
            } else {
                System.out.println("输入错误，请重新输入");
            }
        }
    }
    public static void main(String[] args) {
        BookList booklist = new BookList();
        User user = logn();
        while(true) {
            int choice = user.menu();
            user.Dooperation(choice,booklist);
        }

    }
}
